CREATE TABLE [dbo].[DnnProduct_CDS_RedemptionCodes]
(
[RedemptionCode] [varchar] (8) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[DownloadUrl] [varchar] (max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[RequestID] [int] NOT NULL,
[DistOrderItemId] [int] NULL,
[ExpDate] [datetime] NULL,
[ID] [int] NOT NULL IDENTITY(1, 1)
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [dbo].[DnnProduct_CDS_RedemptionCodes] ADD CONSTRAINT [PK_DnnProduct_CDS_RedemptionCodes] PRIMARY KEY CLUSTERED  ([ID]) ON [PRIMARY]
GO
CREATE UNIQUE NONCLUSTERED INDEX [UIX_DnnProduct_CDS_RedemptionCodes_RedemptionCode] ON [dbo].[DnnProduct_CDS_RedemptionCodes] ([RedemptionCode]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DnnProduct_CDS_RedemptionCodes] ADD CONSTRAINT [FK_DnnProduct_CDS_RedemptionCodes_DnnProduct_CDS_Requests] FOREIGN KEY ([RequestID]) REFERENCES [dbo].[DnnProduct_CDS_Requests] ([ID]) ON DELETE CASCADE
GO
